-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preserve logger reports through translation by encapculating translated output in report_cb #14380
Preserve logger reports through translation by encapculating translated output in report_cb #14380
Conversation
output in report_cb
I am happy with this approach, if tests pass. :)
Yes, it is a problem. It is probably best to store the translated message in the map or metadata and have a static
|
Thanks! I like the idea of storing the translated message in metadata and use a static
I was actually considering something like this at first, but realized midway that one incidental purpose of the translator is to enrich log events with Elixir-specific metadata, such as |
You are right, we cannot do it then. Let's stick to your approach then! |
Oh I just realized storing translated message in the metadata isn't the option, as |
Go for it! |
8d34c97
to
00992b0
Compare
I made another approach to this and it seems like the problem of presenting translator output (chardata) as |
00992b0
to
2159b52
Compare
💚 💙 💜 💛 ❤️ |
The thing that is bothering me and that I'm looking for a way to address is the fact that translators are destructive to the report log messages. Most reports don't survive default translator and are replaced with a chardata, but some logger handlers clearly have a demand for the original report data, since they go as far as parsing chardata to build their own report.
One idea I have is that instead of converting report to chardata, translator could wrap the
report_cb
callback function, since the existing one would be useless after the translation anyway.Some caveats with this approach:
report_cb
can have any performance implications or run into problems with multi-node setup?report_cb
use is a little different from what translator does right now, so there's probably more changes to make here to make it return format string (?).In general I would love to get some feedback on if this is the right way to approach this or if there is even a good way 🙏